package com.zbkj.crmeb.member.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zbkj.crmeb.member.dao.ChannelMerchantAttributeDao;
import com.zbkj.crmeb.member.model.ChannelMerchantAttribute;
import com.zbkj.crmeb.member.service.IChannelMerchantAttributeService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 渠道商户属性表 服务实现类
 * </p>
 *
 * @author xx
 * @since 2022-05-17
 */
@Service
public class ChannelMerchantAttributeServiceImpl extends ServiceImpl<ChannelMerchantAttributeDao, ChannelMerchantAttribute> implements IChannelMerchantAttributeService {

    @Override
    public boolean updatePickingAppBar(Integer merId, Integer status) {
        return this.update(Wrappers.<ChannelMerchantAttribute>lambdaUpdate().set(ChannelMerchantAttribute::getIsPicking,status).eq(ChannelMerchantAttribute::getMerId,merId));
    }

    @Override
    public Integer getAppBarInfo(Integer merId) {
        ChannelMerchantAttribute attribute = this.getOne(Wrappers.<ChannelMerchantAttribute>lambdaQuery().eq(ChannelMerchantAttribute::getMerId, merId).last("LIMIT 1").select(ChannelMerchantAttribute::getMerId, ChannelMerchantAttribute::getIsPicking));
        return attribute.getIsPicking();
    }

}
